home *** CD-ROM | disk | FTP | other *** search
/ Introducing the New Way to Shop From Home / Introducing the New Way to Shop From Home (Iceland Foods) (2003).iso / pc / help.dxr / UI elements_47_jump to frame.ls < prev    next >
Encoding:
Text File  |  2003-01-01  |  7.2 KB  |  154 lines

  1. property getPDLError, myBehaviorName, myDistantMovie, myDistantMarker, myJumpMode, myReturn
  2.  
  3. on getBehaviorDescription me
  4.   return "JUMP TO MOVIE BUTTON" & RETURN & RETURN & "A click on the sprite makes the playback head jump to any other movie available to your system. " & "An optional marker name can be used to jump to a precise point in the new movie. " & "(Use the 'Jump to Marker Button' behavior to jump to a marker in the current movie)." & RETURN & RETURN & "In order to make use of the Play and Return option, place a Play Done command in the destination movie." & RETURN & RETURN & "This behavior is designed for use with the 'Jump Back Button'. " & "You can set it to record the movie name and the frame number of the current marker so that the 'Jump Back Button' can subsequently return. " & "NOTE: This feature relies on a global variable: gNavigationButtonList." & RETURN & RETURN & "PERMITTED MEMBER TYPES" & RETURN & "Graphic members" & RETURN & RETURN & "PARAMETERS:" & RETURN & "* Movie to jump to" & RETURN & RETURN & "If the target movie is in the same folder as the current movie then you need only enter the name of the movie. " & "If the movie is in a different folder, then enter the full or relative path name to the target movie." & RETURN & RETURN & "* Marker to jump to in the new movie (optional)" & RETURN & "* 'Go to' or 'Play and return'?" & RETURN & "* Remember current marker for Back button?" & RETURN & RETURN & "Select 'Remember current marker for Back button' to ensure that the behavior 'remembers' which markers have already been visited." & RETURN & RETURN & "Use the associated 'Jump Back Button' behavior on a separate sprite to return to visited movies in reverse order." & RETURN & RETURN & "ASSOCIATED BEHAVIORS:" & RETURN & "+ Jump to Marker Button" & RETURN & "+ Jump Back Button" & RETURN & "+ Jump Forward Button" & RETURN & "+ Push Button (to alter rollover / mouseDown states)"
  5. end
  6.  
  7. on getBehaviorTooltip me
  8.   return "Use with graphic members." & RETURN & RETURN & "Jumps to a specified movie on mouseUp." & RETURN & RETURN & "Use this behavior with the 'Jump Back Button' to allow the user to return to visited movies."
  9. end
  10.  
  11. on beginSprite me
  12.   Initialize(me)
  13. end
  14.  
  15. on mouseUp me
  16.   jump(me)
  17. end
  18.  
  19. on Initialize me
  20.   global gNavigationButtonList
  21.   myBehaviorName = string(me)
  22.   delete word 1 of myBehaviorName
  23.   delete char -30001 of myBehaviorName
  24.   delete char -30001 of myBehaviorName
  25.   if myReturn then
  26.     if voidp(gNavigationButtonList) then
  27.       gNavigationButtonList = [#stack: [], #forward: [], #index: []]
  28.     else
  29.       if gNavigationButtonList.ilk <> #propList then
  30.         ErrorAlert(me, #invalidGlobal, gNavigationButtonList)
  31.       else
  32.         if not gNavigationButtonList.findPos(#stack) then
  33.           ErrorAlert(me, #invalidGlobal, gNavigationButtonList)
  34.         else
  35.           if not gNavigationButtonList.findPos(#index) then
  36.             ErrorAlert(me, #invalidGlobal, gNavigationButtonList)
  37.           else
  38.             if not gNavigationButtonList.findPos(#forward) then
  39.               ErrorAlert(me, #invalidGlobal, gNavigationButtonList)
  40.             end if
  41.           end if
  42.         end if
  43.       end if
  44.     end if
  45.   end if
  46.   case myDistantMarker of
  47.     EMPTY, " ":
  48.       myDistantMarker = 0
  49.   end case
  50. end
  51.  
  52. on jump me
  53.   global gNavigationButtonList
  54.   currentMarker = [#frame: marker(0), #movie: the movieName]
  55.   if myReturn then
  56.     gNavigationButtonList.stack.append(currentMarker)
  57.     if not gNavigationButtonList.index.getPos(currentMarker) then
  58.       gNavigationButtonList.index.append(currentMarker)
  59.     end if
  60.     gNavigationButtonList.forward = []
  61.   end if
  62.   if myJumpMode = "Go to" then
  63.     go(marker(myDistantMarker), myDistantMovie)
  64.   else
  65.     play frame marker(myDistantMarker) of movie myDistantMovie
  66.   end if
  67.   if the movieName = myDistantMovie then
  68.     if the frameLabel <> myDistantMarker then
  69.       ErrorAlert(me, #invalidMarker, currentMarker)
  70.     end if
  71.   end if
  72. end
  73.  
  74. on substituteStrings me, parentString, childStringList
  75.   i = childStringList.count()
  76.   repeat while i
  77.     tempString = EMPTY
  78.     dummyString = childStringList.getPropAt(i)
  79.     replacement = childStringList[i]
  80.     lengthAdjust = dummyString.char.count - 1
  81.     repeat while 1
  82.       position = offset(dummyString, parentString)
  83.       if not position then
  84.         parentString = tempString & parentString
  85.         exit repeat
  86.         next repeat
  87.       end if
  88.       if position <> 1 then
  89.         tempString = tempString & parentString.char[1..position - 1]
  90.       end if
  91.       tempString = tempString & replacement
  92.       delete parentString.char[1..position + lengthAdjust]
  93.     end repeat
  94.     i = i - 1
  95.   end repeat
  96.   return parentString
  97. end
  98.  
  99. on ErrorAlert me, theError, data
  100.   behaviorName = string(me)
  101.   delete word 1 of behaviorName
  102.   delete char -30001 of behaviorName
  103.   delete char -30001 of behaviorName
  104.   case data.ilk of
  105.     #void:
  106.       data = "<void>"
  107.     #symbol:
  108.       data = "#" & data
  109.   end case
  110.   case theError of
  111.     #getPDL_Invalid:
  112.       terror1 = "BEHAVIOR ERROR: Frame ^0, Sprite ^1"
  113.       terror1 = substituteStrings(me, terror1, ["^0": the frame, "^1": the currentSpriteNum])
  114.       terror2 = "Parameters for behavior ^0 have not been correctly set. " & "Select a valid movie name in the Behavior Parameters dialog."
  115.       terror2 = substituteStrings(me, terror2, ["^0": myBehaviorName])
  116.       terror3 = "Current movie = ^0"
  117.       terror3 = substituteStrings(me, terror3, ["^0": data])
  118.       alert(terror1 & RETURN & RETURN & terror2 & RETURN & RETURN & terror3)
  119.       halt()
  120.     #invalidGlobal:
  121.       terror1 = "BEHAVIOR ERROR: Frame ^0, Sprite ^1"
  122.       terror1 = substituteStrings(me, terror1, ["^0": the frame, "^1": the currentSpriteNum])
  123.       terror2 = "Behavior ^0 requires a global gNavigationButtonList with the following" & RETURN & " structure:"
  124.       terror2 = substituteStrings(me, terror2, ["^0": myBehaviorName])
  125.       terror3 = "[#stack [...], #index: [...], #forward: [...]]"
  126.       terror4 = "Current value = ^0"
  127.       terror4 = substituteStrings(me, terror4, ["^0": data])
  128.       alert(terror1 & RETURN & RETURN & terror2 & RETURN & RETURN & terror3 & RETURN & RETURN & terror4)
  129.       abort()
  130.     #invalidMarker:
  131.       if the runMode = "Author" then
  132.         put RETURN & the labelList
  133.         terror1 = "BEHAVIOR ERROR: ^0, Sprite ^1"
  134.         terror1 = substituteStrings(me, terror1, ["^0": data, "^1": the currentSpriteNum])
  135.         terror2 = "Behavior ^0"
  136.         terror2 = substituteStrings(me, terror2, ["^0": myBehaviorName])
  137.         terror3 = "There is no marker ^0 in movie ^1. " & "Enter a valid marker (see Message Window) in the Behavior Parameters dialog."
  138.         terror3 = substituteStrings(me, terror3, ["^0": QUOTE & myDistantMarker & QUOTE, "^1": myDistantMovie])
  139.         alert(terror1 & RETURN & RETURN & terror2 & RETURN & RETURN & terror3)
  140.       end if
  141.   end case
  142. end
  143.  
  144. on isOKToAttach me, aSpriteType, aSpriteNum
  145.   return aSpriteType = #graphic
  146. end
  147.  
  148. on getPropertyDescriptionList me
  149.   if not (the currentSpriteNum) then
  150.     exit
  151.   end if
  152.   return [#myDistantMarker: [#comment: "Marker in the other movie (optional)", #format: #string, #default: " "], #myJumpMode: [#comment: "Jump Mode", #format: #string, #range: ["Go to", "Play and Return"], #default: "Go to"], #myReturn: [#comment: "Remember current marker for Back button?", #format: #boolean, #default: 1]]
  153. end
  154.